'''
Author: kun 56216004@qq.com
Date: 2023-06-27 16:23:32
LastEditors: kun 56216004@qq.com
LastEditTime: 2023-06-27 18:15:07
FilePath: \langchain\ask1.py
Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
'''

# 用LangChain构建大语言模型应用-阿里云开发者社区  https://developer.aliyun.com/article/1221923#slide-5
# python=3.9
# 专有模型，例如：OpenAI
# pip install openai
from langchain.llms import OpenAI
import openai
openai.api_base = "https://api.chatanywhere.com.cn/v1"
from config import * 
# openai.api_key = api_key
import os
os.environ["OPENAI_API_KEY"] = api_key # 填入OpenAI Secret Key

llm = OpenAI(model_name="text-davinci-003")





# llm实例接受一个提示输入，返回字符串作为输出
prompt = u"中国的首都是？"
prompt = u"奥巴马的生日是哪年哪天? 到2023年他多少岁了？"

completion = llm(prompt)
print(completion)
